<template>
  <t-dialog
    :header="`${header}-标准详情`"
    :visible.sync="visible"
    :onClose="closeDialog"
    :closeOnOverlayClick="false"
    :confirmBtn="null"
    width="80%"
    top="5%"
  >
    <standard-detail  :objId="objId"></standard-detail>
    <!-- <t-tabs placement="left"  size="medium" v-model="stepValue">
      <t-tab-panel  value="1" label="申报详情">
          <standard-detail :objId="objId"></standard-detail>
      </t-tab-panel>
      <t-tab-panel  value="2" label="征求意见详情">
        <t-table
          rowKey="index"
          :data="data"
          :columns="columns"
          size="small"
          v-if="data.length>0"
        >
          <template  #dealOpinion="{ row }">
            <t-tag :theme="handleTheme(row.dealOpinion,dict.type.deal_opinion)" variant="light" v-if="row.dealOpinion">
              {{row.dealOpinion | filterByDict(dict.type.deal_opinion)}}
            </t-tag>
            <div v-else>
              -
            </div>
          </template>
          <template  #note="{ row }">
            <div v-if="row.note">{{row.note}}</div>
            <div v-else>-</div>
          </template>
          <template  #summary="{ row }">
            <t-tag v-if="row.summary==='1'" theme="success"  variant="light">已汇总</t-tag>
            <t-tag v-else theme="default"  variant="light">未汇总</t-tag>
          </template>
        </t-table>
        <div v-else style="height: 100%;display: flex;justify-content: center;align-items: center;font-weight: bold;font-size: 50px;color: #ccc;">待提交...</div>
      </t-tab-panel>
      <t-tab-panel  value="3" label="报审详情">
          <standard-bs-detail v-if="openBS" :objId="objId"></standard-bs-detail>
        <div v-else style="height: 100%;display: flex;justify-content: center;align-items: center;font-weight: bold;font-size: 50px;color: #ccc;">待报审...</div>
      </t-tab-panel>
      <t-tab-panel  value="4" label="登记详情">
        <register-detail v-if="openDJ" :objId="objId"></register-detail>
        <div v-else style="height: 100%;display: flex;justify-content: center;align-items: center;font-weight: bold;font-size: 50px;color: #ccc;">待登记...</div>
      </t-tab-panel>
    </t-tabs> -->
  </t-dialog>
</template>

<script>
import StandardDetail from "./standard-detail.vue";
import StandardBsDetail from "./standard-bs-detail.vue";
import RegisterDetail from "../../register/components/register-detail.vue";

export default {
  name: "standard-detail-dialog",
  dicts: ['formulate_type', "deal_opinion"],
  components:{
    StandardDetail,
    StandardBsDetail,
    RegisterDetail
  },
  props:{
    objId: [String,Number],
    header: String,
    tabDefaultValue: {
      type: String,
      default: '1'
    }
  },
  data(){
    return {
      visible: true,
      stepValue: this.tabDefaultValue,
      openBS: false,
      openDJ: false,
      queryParams:{
        pageNum:1,
        pageSize:10,
        projectName:"",
        formulateType:"",
        publicDateRange: [],
      },
      pagination: {
        current: 1,
        pageSize: 10,
        total: 0,
        showPageSize: true,
        pageSizeOptions: [10, 20, 30, 50],
        showFirstAndLastPageBtn: false,
        onChange: (pageInfo) => {
          Object.assign(this.pagination,pageInfo)
          this.queryParams.pageNum = pageInfo.current || 1;
          this.queryParams.pageSize = pageInfo.pageSize;
          this.getList()
        },
      },
      dialog:{
        objId:"",
        header:"",
        open_detail: false,
      },
      sort:[],
      dataLoading: false,
      columns:[
        {
          colKey: 'chapterNum',
          title: '地方标准章条编号',
          align:"center"

        },
        {
          colKey: 'opinion',
          title: '意见内容',
          align:"center"
        },
        {
          colKey: 'personName',
          title: '提出人',
          align:"center"
        },
        {
          colKey: 'deptName',
          title: '提出单位',
          align:"center"
        },
        {
          colKey: 'summary',
          title: '汇总状态',
          align:"center"
        },
        {
          colKey: 'dealOpinion',
          title: '处理意见',
          align:"center"
        },
        {
          colKey: 'note',
          title: '备注',
          align:"center"
        },
      ],
      data: []
    }
  },
  created() {
    // this.checkBS();
    // this.checkDJ();
    // this.localStandardList();
  },
  methods:{
    localStandardList(){
      this.$api.bzh.opinion.localStandardList({localId:this.objId}).then(res=>{
        this.data = res.rows
      }).catch(err=>{
        this.$message.error(err)
      })
    },
    checkDJ(){
      this.$api.bzh.standard.getSuggest(this.objId).then(response => {
        if(response.data){
          this.openDJ = true
        }
      }).catch((e) => {
        this.$message.error(e.toString());
      });
    },
    checkBS(){
      this.$api.bzh.report.getByLocalId(this.objId).then(response => {
        if(response.data){
          this.openBS = true
        }
      }).catch((e) => {
        this.$message.error(e.toString());
      });
    },
    closeDialog() {
      this.$emit("update:visible", false);
    },
  }
}
</script>

<style lang="less" scoped>
.t-tab-panel{
  padding: 10px;
  height: 65vh;
}
</style>
